Conversation
This properly defines `supports_vector_interface` and `supports_matrix_interface` for `GradVector` and `GradgenOperator`, respectively, and implement the full required interface, as checked by `check_operator` and `check_state`.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18 +/- ##
========================================
+ Coverage 80.0% 87.5% +7.5%
========================================
Files 5 5
Lines 185 278 +93
========================================
+ Hits 148 243 +95
+ Misses 37 35 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR expands GradVector and GradgenOperator to provide the vector/matrix interfaces expected by QuantumPropagators.Interfaces (via check_state / check_operator), enabling compatibility with external propagation utilities that assume array-like behavior.
Changes:
- Adds full vector-like Base/LinearAlgebra interface methods for
GradVector(e.g.,size,getindex,setindex!,iterate, andsimilarvariants). - Adds matrix-like Base/LinearAlgebra interface methods for
GradgenOperator(e.g.,getindex,iterate,length, andsimilarvariants) and definessupports_matrix_interface. - Extends interface-focused tests to validate the new behaviors and trait reporting.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/linalg.jl |
Implements vector/matrix interface methods (size/getindex/iterate/similar etc.) plus mul! and dot overloads to satisfy interface checks. |
src/grad_vector.jl |
Defines supports_vector_interface / type-based supports_inplace for GradVector and updates resetgradvec! to use type-based trait checks. |
src/gradgen_operator.jl |
Defines type-based supports_inplace and supports_matrix_interface for GradgenOperator. |
test/test_interface.jl |
Adds targeted tests for vector/matrix interface compliance and trait behavior for both dense and static backends. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This properly defines
supports_vector_interfaceandsupports_matrix_interfaceforGradVectorandGradgenOperator, respectively, and implement the full required interface, as checked bycheck_operatorandcheck_state.This is a prerequisite to propagating gradient vectors via
ExponentialUtilities(or similar external packages that assume anAbstractVectorinterface), see JuliaQuantumControl/QuantumPropagators.jl#97